import { http } from "@/plugins/axios";
import router from "@/plugins/router";
import XEUtils from "xe-utils";
const storage = useStorage();

export default () => {
  const dataState = ref({
    course: {
      groupcoursesCount: 0,
      personalcoursesCount: 0,
    },
    employee: {
      employeeCount: 0,
      employeeGivenCount: 0,
    },
    schedule: {
      groupscheduleCount: 0,
      personalscheduleCount: 0,
    },
    appointment: {
      groupappointmentCount: 0,
      personalappointmentCount: 0,
    },

    activity: {
      activityCount: 0,
      activityAmount: 0,
    },
    sale: {
      groupsaleCount: 0,
      personalsaleCount: 0, //订单多少
      groupsalePrice: 0,
      personalsalePrice: 0, //总金额多少
      groupsaleAmount: 0, //多少节课
      personalsaleAmount: 0,
    },
    sign: {
      groupsignCount: 0,
      personalsignCount: 0,
    },
    user: {
      userNormalCount: 0,
      userVipCount: 0,
    },
    chartGSaleData: [],
    chartPSaleData: [],
    chartGApptData: [],
    chartPApptData: [],
  });
  // 方法
  const indexDashboard = async (params) => {
    dataState.value = await http.request({
      url: `admin/dashboard?monthStr=${params}`,
      method: "get",
    });
  };
  return {
    indexDashboard,
    dataState,
  };
};
